package fengstyle.service;

import fengstyle.po.User;
import fengstyle.repository.UserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Resource
    private UserRepository userRepository;

    public List<User> list() {
        return userRepository.list();
    }

    public Long add(User user) {
        userRepository.insert(user);
        return 1L;
    }

    @Override
    public User findById(Long id) {
        return userRepository.findById(id);
    }

    @Override
    public User findByName(String name) {
        return userRepository.findByName(name);
    }
}
